﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Main.aspx.cs" Inherits="Whir_System_Module_Template_Main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <link href="../../Skin/Default/Css/main.css" rel="stylesheet" type="text/css" />
    <script src="../../Js/common.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Script/Validate.js"></script>
    <script language="javascript" type="text/javascript">
        if (top.location == self.location) { 
            alert('禁止访问子栏目页！将跳转到默认页面');
            top.location='../../Default.aspx';
        } 
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="tips">
        选择左侧栏目（单选）与右侧模版（单选），点击“匹配”按钮进行模版匹配<br />左侧栏目列表中第一个括号代表对应栏目匹配的首页模板，第二个括号代表栏目匹配的列表模板，第三个括号代表栏目匹配的内容模板。
    </div>
    <table width="100%" align="center" cellpadding="3" cellspacing="0">
        <tr>
            <td width="380" align="center">栏目列表：</td>
            <td>首页模板列表：</td>
            <td>列表模板列表：</td>
            <td>内容模板列表：</td>
        </tr>
        <tr>
            <td>
                <asp:ListBox ID="lbColumn" runat="server" Width="100%" Height="400px"></asp:ListBox>
            </td>
            <td>
                <asp:ListBox ID="lbdefaultTemp" runat="server" Width="100%" Height="400px" onfocus="selectedNotAll('lblistTemp','lbcontentTemp');"></asp:ListBox>
            </td>
            <td>
                <asp:ListBox ID="lblistTemp" runat="server" Width="100%" Height="400px" onfocus="selectedNotAll('lbdefaultTemp','lbcontentTemp');"></asp:ListBox>
            </td>
            <td>
                <asp:ListBox ID="lbcontentTemp" runat="server" Width="100%" Height="400px" onfocus="selectedNotAll('lblistTemp','lblistTemp');"></asp:ListBox>
            </td>
        </tr>
        <tr>
            <td width="380" align="center">
                <asp:Button ID="Button4" runat="server" Text="全部取消" class="btn_default" CommandName="all" OnClick="btnCancel_Click" OnClientClick="return btnAllClick();" />
            </td>
            <td align="center">
                <asp:Button ID="btnDefaultTemp" runat="server" Text="匹配" class="btn_default1" CommandName="default" OnClick="btnBind_Click" OnClientClick="return btnDefaultTempClick();" />
                <asp:Button ID="Button1" runat="server" Text="取消" class="btn_default1" CommandName="default" OnClick="btnCancel_Click" OnClientClick="return btnAllClick();" />
            </td>
            <td align="center">
                <asp:Button ID="btnlistTemp" runat="server" Text="匹配" class="btn_default1" CommandName="list" OnClick="btnBind_Click" OnClientClick="return btnlistTempClick();" />
                <asp:Button ID="Button2" runat="server" Text="取消" class="btn_default1" CommandName="list" OnClick="btnCancel_Click" OnClientClick="return btnAllClick();" />
            </td>
            <td align="center">
                <asp:Button ID="btncontentTemp" runat="server" Text="匹配" class="btn_default1" CommandName="content" OnClick="btnBind_Click" OnClientClick="return btncontentTempClick();" />
                <asp:Button ID="Button3" runat="server" Text="取消" class="btn_default1" CommandName="content" OnClick="btnCancel_Click" OnClientClick="return btnAllClick();" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
<script language="javascript" type="text/javascript">
function btnAllClick() {
    var lbColumn = document.getElementById("lbColumn");
    if (lbColumn.selectedIndex == -1) {
        alert("请选择栏目！");
        return false;
    }
    return true;
}
function btnDefaultTempClick() {
    var lbColumn = document.getElementById("lbColumn");
    var lbdefaultTemp = document.getElementById("lbdefaultTemp");
    if (lbColumn.selectedIndex == -1) {
        alert("请选择栏目！");
        return false;
    }
    
    if (lbdefaultTemp.selectedIndex == -1) {
        alert("请选择首页模板！");
        return false;
    }
    
    return true;
}
function btnlistTempClick() {
    var lbColumn = document.getElementById("lbColumn");
    var lbdefaultTemp = document.getElementById("lblistTemp");
    if (lbColumn.selectedIndex == -1) {
        alert("请选择栏目！");
        return false;
    }
    
    if (lbdefaultTemp.selectedIndex == -1) {
        alert("请选择列表模板！");
        return false;
    }
    
    return true;
}
function btncontentTempClick() {
    var lbColumn = document.getElementById("lbColumn");
    var lbdefaultTemp = document.getElementById("lbcontentTemp");
    if (lbColumn.selectedIndex == -1) {
        alert("请选择栏目！");
        return false;
    }
    
    if (lbdefaultTemp.selectedIndex == -1) {
        alert("请选择内容模板！");
        return false;
    }
    
    return true;
}
function selectedNotAll(lb1, lb2) {
    document.getElementById(lb1).selectedIndex = -1;
    document.getElementById(lb2).selectedIndex = -1;
}
</script>